<?php
class SpagesController extends AppController{
    var $name='Spages';
    
    function index($id=null){
        $this->set('spages',$this->Spage->find('all',array('conditions'=>'screens_id='.$id)));
        
    }
    
    function edit($id=null){
        if(empty($this->data)){
            $this->Spage->id = $id;
            $this->data = $this->Spage->read();
        }else{
            if($this->Page->save($this->data['Spage'])){
                $this->flash('Your page has been updated.');
                $this->redirect(array('action'=>'index'));
            }
        }
    }
    
    function delete($id){
        $this->Spage->del($id);
        $this->flash('The page with id: '.$id.' has been deleted.',
        '/spages');
    }
}  
?>
